/**
 * 
 */
package com.smarthome.web.property.controller.area;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.smarthome.domain.bean.ShAreaCity;
import com.smarthome.domain.bean.ShAreaDistrict;
import com.smarthome.domain.bean.ShAreaProvince;
import com.smarthome.domain.common.Result;
import com.smarthome.web.property.utils.AreaUtil;

/**
 * @author dhc
 * @date 2015年10月12日 下午9:16:10
 * @title
 */
@Controller
@RequestMapping("/area")
public class AreaController {


	 @RequestMapping("/province")
	 @ResponseBody
	public List<ShAreaProvince> getShAreaProvinces(){
		 
	  return	AreaUtil.getAllProvince();
	}
	 
	 @RequestMapping("/provinceid")
	 @ResponseBody
	 public ShAreaProvince getShAreaProvince(Long id){
		 return	AreaUtil.getProvince(id);
	 }
	 
	 @RequestMapping("/city")
	 @ResponseBody
	 public List<ShAreaCity> getShAreaCitys(){
		 return AreaUtil.getAllCity();
	 }
	@RequestMapping("/cityid")
	@ResponseBody
	public ShAreaCity getShAreaCity(Long id){
		 return AreaUtil.getCity(id);
	 }
	
	@RequestMapping("/district")
	@ResponseBody
	public List<ShAreaDistrict> getAreaDistricts(){
		return AreaUtil.getAllDistrict();
	}
	@RequestMapping("/districtid")
	@ResponseBody
	public ShAreaDistrict getAreaDistrict(Long id){
		return AreaUtil.getDistrict(id);
	}
	
	@RequestMapping("/reflash")
	@ResponseBody
	public Result reflash(Long id){
		AreaUtil.reflashAll();
		return Result.success("success");
	}
	
	
}
